package report

import (
	"fmt"

	"github.com/shirou/gopsutil/v3/mem"
)

type MemoryInfo struct {
	Total       uint64  `json:"total"`
	Available   uint64  `json:"available"`
	Used        uint64  `json:"used"`
	Free        uint64  `json:"free"`
	UsedPercent float64 `json:"usedPercent"`
}

func FetchMemoryInfo() MemoryInfo {
	// This is a stub, replace it with the actual implementation
	info := MemoryInfo{
		Total:     0,
		Available: 0,
		Used:      0,
		Free:      0,
	}

	vms, err := mem.VirtualMemory()
	if err == nil {
		info.Total = vms.Total
		info.Available = vms.Available
		info.Used = vms.Used
		info.Free = vms.Free
		info.UsedPercent = vms.UsedPercent
	}

	return info
}

func (m MemoryInfo) Show() {
	// This is a stub, replace it with the actual implementation
	fmt.Printf("memory.Total: %v\n", m.Total)
	fmt.Printf("memory.Available: %v\n", m.Available)
	fmt.Printf("memory.Used: %v\n", m.Used)
	fmt.Printf("memory.Free: %v\n", m.Free)
}
